package common.doctor;

import java.io.IOException;

import org.json.JSONException;
import org.json.JSONObject;


import api.doctor.GetAPIAccountInfoPC;



/**
 * 医生类
 * 定义医生属性和方法
 * @author gaowen
 *
 */
public class Doctor
{
	public int id;
	public String token;
	public String name;
	public String account;
	public String password;
	public String voipaccount;
	
	/**
	 * 医生类构造函数
	 * @param account
	 * @param password
	 * @throws IOException 
	 * @throws JSONException 
	 */
	public Doctor(String account,String password) throws JSONException, IOException
	{
		setDocInfo(account, password);
	}
	
	/**
	 * 设置医生属性
	 * @param account
	 * @param password
	 * @throws JSONException
	 * @throws IOException
	 */
	public void setDocInfo(String account,String password)throws JSONException, IOException
	{
		JSONObject docData=new JSONObject(GetAPIAccountInfoPC.post(account, password));
		this.token=docData.getString("Token");
		this.id=docData.getJSONObject("UserModel").getInt("ID");
		this.account=account;
		this.password=password;
		this.voipaccount=docData.getJSONObject("UserModel").getString("voipAccount");
		this.name=docData.getJSONObject("UserModel").getString("UserName");	
	}
	
	
}

